Brian Idzik wrote:
I've successfully setup a xhtml 1.0 strict page with Mozilla & Netscape
to display links in a toolbar into an internal <div id='content'> within
the same document. The toolbar uses some javascript, but mostly CSS
class & id elements.
Mozilla & Netscape work fine handling the toolbar submenus & contents,
but IE6 misbehaves on several areas.
On loading the page, the target div (id='content') will not display.
When a menu item is selected from the toolbar popup menus, the first
selection displays in the content div, but the z-indexing doesn't work.
A picture's worth a 1,000 words, so if you have experience with this,
check out http://idzgw2.homeunix.org/idz.html. the page validates as
XHTML 1.0 strict compliant, but the page doesn't work properly under IE.
Well, IE doesn't even support XHTML so throwing XHTML at it doesn't
increase your chances that the page "works properly".
And a valid XHTML page doesn't mean that the browser can handle your
misguided attempts of building a page that relies on JavaScript to work.
For instance you have links alike
<a class="menuItem"
title="Seti@home"
href="javascript
:loadPage('http://setiathome.ssl.berkeley.edu/index.html');">
Seti@home</a>
meaning the whole menu depends on JavaScript to be enabled. And loadPage
looks as follows
function loadPage (url) {
if (browser.isNS) {
document.getElementById('content').innerHTML='<obj ect id="url"
style="width:642px;height:370px;z-index:10;" data="' + url + '"
type="text/html">A DOM Compliant browser is required to view this
document</object>';
} else if (browser.isIE) {
document.all['content'].innerHTML='<object id="url"
type="text/x-scriptlet"
style="width:642px;height:370px;overflow:auto;z-index:10;" data="' + url
+ '">A DOM/W3C compliant browser is needed to open this page.</object>';
} else {
alert("Please have your computer support staff upgrade your
browser");
}
}
so obviously you don't have any interest in browsers that implement
XHTML 1.0 but only in browsers that your scripts sniffer recognizes as
NS or IE.
If you want to have a link to load the referenced URL into an element in
your page then use the HTML <iframe> element and a HTML link targetting
the iframe:
<a href="http://setiathome.ssl.berkeley.edu/index.html"
target="contentFrame">Seti@home</a>
<iframe name="contentFrame" width="200" height="200"></iframe>
No need to throw JavaScript at the browser or even any "Please have your
computer support staff upgrade your browser" messages.
Admittedly <iframe> is not part of XHTML 1.0 strict but it is at least
supported by browsers without all the flaws and shortcomings of the
<object> element implementation in current browsers.
And with many browsers iframes (or objects) are implemented as so called
windowed controls meaning they are always on top of other elements even
if CSS z-index is applied but that is a known issue and if you want your
page to be rendered by as much user agents as possible you would better
not rely on a JavaScript menu to be able to lie on top of <iframe> (or
<object>) elements.
--
Martin Honnen
http://JavaScript.FAQTs.com/